NotificationPortlet = Class.extend({
	init: function()	{
		this.name = "NotificationPortlet";
	},
	
	onBegin: function()	{
		this.registerObserver();
	},
	
	onEnd: function()	{
		this.unregisterObserver();
	},
	
	onReloadPage: function()	{
		this.run();
	},
	
	run: function()	{
		//store the current object
		var loggedin = SingletonFactory.getInstance(Application).getSystemProperties().get('user.login');
		if (loggedin == 0)
			return;
		var obj = this;
		this.onAjax('user', 'count-new-notifications', {}, 'GET', {
			'onSuccess': function(ret)	{
				obj.model = {};
				obj.model.result = ret;
				obj.getPortletPlaceholder().paintCanvas(obj.render());
			}
		});
	}
}).implement(PortletInterface).implement(RenderInterface).implement(AjaxInterface).implement(ObserverInterface);